import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { RouterProvider } from "react-router-dom";
import { Provider } from 'mobx-react'
import { getLangByUrl } from '@/util';

import * as serviceWorkerRegistration from './serviceWorkerRegistration';
import '@assets/css/reset.css';           // 重置浏览器样式
import '@/static/css/tailwind.css';
import '@assets/css/public.css';          // 全局共用样式(慎重修改)
import '@assets/css/antd.ui.reset.css';   // 蚂蚁UI组件库样式覆盖

import { router } from "@/routes/index";
import publicStore from '@/store/public';

if(window.location.pathname === '/'){
  // 异常处理(暂时，不是最优方案)
  window.location.href = '/' + getLangByUrl();
}

const root = createRoot(document.getElementById('root'));
root.render(
  <Provider {...publicStore}>
    <StrictMode>
      <RouterProvider router={router} />
    </StrictMode>
  </Provider>
);
serviceWorkerRegistration.unregister();